<?php
    $data = array();
    $dataSavePoints = array();
    $categories = array();
    foreach($licensee_point_list as $licenseePoint){

        if(!empty($licenseePoint[ 'nb_points_fftt' ])){
            $data[] = intval($licenseePoint[ 'nb_points_fftt' ]);
        }else{
            $data[] = end($data);
        }

        if(!empty($licenseePoint[ 'nb_points' ])){
            $dataSavePoints[] = intval($licenseePoint[ 'nb_points' ]);
        }else if(!empty($licenseePoint[ 'nb_points_fftt' ])){
            $dataSavePoints[] = intval($licenseePoint[ 'nb_points_fftt' ]);
        }

        if(!empty($licenseePoint[ 'nb_points' ])){
            $categories[] = date("M", strtotime($licenseePoint[ 'datetime_points' ])) . ".";
        }else if(!empty($licenseePoint[ 'nb_points_fftt' ])){
            $categories[] = date("M", strtotime($licenseePoint[ 'datetime_points' ])) . ".";
        }
    }

    $mensualPoint = "-";
    $evoMensualPoint = "-";
    $startSeasonMensualPoint = "-";
    if(count( $data ) > 0){
        $mensualPoint = end($data);
        $startSeasonMensualPoint = $data[0];
        $evoMensualPoint = end($data) - prev($data);
    }
    $data = json_encode( $data );
    $dataSavePoints = json_encode( $dataSavePoints );
    $categories = json_encode( $categories );
?>

<script type="text/javascript">
    var data = <?php echo $data ?>;
    var dataSavePoints = <?php echo $dataSavePoints ?>;
    var categories = <?php echo $categories ?>;
</script>

<?php include_partial('member/profilMenuTop', array('member_info' => $member_info, 'selected' => 1)); ?>

<?php $imagesAttributes = Utils::getImageSize($member_info[ 'sfGuardUserProfile' ][ 'User' ]['sfAsset'][ 'Folder' ][ 'relative_path' ], $member_info[ 'sfGuardUserProfile' ][ 'User' ]['sfAsset'], 200, 196); ?>
<?php $hasAvatar = !is_null($member_info[ 'sfGuardUserProfile' ]['User']['sfAsset']['filename']) ? true : false; ?>

<div class="profile-left">
    <div class="avatar">
        <div class="content-avatar">
            <?php if($hasAvatar): ?>
                <?php echo image_tag($imagesAttributes['large']['url'], array('title' => $member_info[ 'sfGuardUserProfile' ][ 'User' ]['sfAsset']['filename'], 'width' => $imagesAttributes['large']['width'], 'height' => $imagesAttributes['large']['height'], 'style' => 'margin-top: ' . $imagesAttributes['large']['marginTop'] . 'px; margin-left: ' . $imagesAttributes['large']['marginLeft'] . 'px')) ?>
            <?php else: ?>
                <?php echo image_tag('/images/noavatar.png', array('title' => 'aucun avatar', 'width' => '200', 'height' => '196')) ?>
            <?php endif ?>
        </div>
    </div>
</div>

<div class="profile-right">
    <h1 class="title">Profil de <?php echo truncate_text($member_info['lastname'] . " " . $member_info['firstname'], 60, '...') ?></h1>

    <h2>&#187; Informations personnelles</h2>
    <?php include_partial('member/personalInfos', array('member_info' => $member_info)); ?>

</div>
<div class="push_float"></div>

<div class="profile-bottom">
    <h2>&#187; Informations tennis de table</h2>
    <?php include_partial('member/pingInfos', array('member_info' => $member_info, 'startSeasonMensualPoint' => $startSeasonMensualPoint, 'mensualPoint' => $mensualPoint, 'evoMensualPoint' => $evoMensualPoint)); ?>
    <h2>&#187; Evolution mensuelle saison <?php echo (date('m') > 8 ? date('Y') . " - " . (date('Y')+1) : (date('Y')-1) . " - " . date('Y')) ?></h2>
    <a href="<?php echo url_for('@member_evolution?name_slug=' . $member_info[ 'slug' ]); ?>">
        <div id="evolutionGraph"></div>
    </a>

    <!--<h2>&#187; Derniers commentaires</h2>-->
</div>